<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //得到的数据
        let data = [
            { name: '四川省', value: 9 },
            { name: '北京', value: 7 },
            { name: '河南省', value: 2 },
            { name: '河北省', value: 9 },
            { name: '西藏自治区', value: 4 },
            { name: '云南省', value: 3 }
        ]


        //地图需要的数据
        let mapData = [
            { name: "南海诸岛", value: 0 },
            { name: "北京", value: 0 },
            { name: "四川", value: 0 },
            { name: "西藏", value: 0 },
            { name: "云南", value: 0 },
            { name: "河北", value: 0 },
            { name: "河南", value: 0 },
        ];

        // let res = data.find(v => {
        //     // return '条件' //找到返回条件   找不到返回undefine
        //     return v.name === '北京'
        // })
        // console.log(res);//{ name: "北京", value: 0 },


        mapData.forEach(item => {
            let res = data.find(v => {
                // return v.name === item.name
                return v.name.includes(item.name)//包含
            })
            // console.log(res);
            if (res) {
                item.value = res.value
            }
        })
        console.log(mapData);
    </script>
</body>

</html>